﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WinnerCMS.Model
{
    /// <summary>
    /// 分页参数类
    /// </summary>
    public class PagingParam
    {
        private int _pageSize;
        /// <summary>
        /// 页码
        /// </summary>
        public int PageSize
        {
            get
            {
                if (this._pageSize < 1)
                {
                    return 1;
                }
                return this._pageSize;
            }
            set
            {
                this._pageSize = value;
            }
        }
        /// <summary>
        /// 页号
        /// </summary>
        public int PageNo { get; set; }
        /// <summary>
        /// 记录数
        /// </summary>
        public int RecordCount { get; set; }

        /// <summary>
        /// 跳过多少数据
        /// </summary>
        public int Skip
        {
            get
            {
                return (PageNo - 1) * PageSize;
            }
        }
        /// <summary>
        /// 分页开头标识
        /// </summary>
        public int StartRecord
        {
            get
            {
                return (PageNo - 1) * PageSize + 1;
            }
        }
        /// <summary>
        /// 分页结尾标识
        /// </summary>
        public int EndRecord
        {
            get
            {
                return StartRecord + PageSize - 1;
            }
        }
    }
}
